package com.fs.chatx.module.chat.enums;

import com.fs.chatx.module.chat.vo.BaseModel;
import com.fs.chatx.module.chat.vo.Provider;
import com.fs.chatx.module.chat.vo.aliyun.BaiLianChatModel;
import com.fs.chatx.module.chat.vo.aliyun.BaiLianEmbedding;
import com.fs.chatx.module.chat.vo.siliconflow.SiliconFlowChatModel;
import lombok.Data;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
public enum ModelProviderEnum
{
    QWENMAX("通义千问-Max",Provider.AliYunBaiLian, new BaiLianChatModel("qwen-max")),
    QWQPLUS("通义千问-QwQ-Plus",Provider.AliYunBaiLian, new BaiLianChatModel("qwq-plus")),

    QWEN7B("通义千问-qwen2.5-7b",Provider.AliYunBaiLian, new BaiLianChatModel("qwen2.5-7b-instruct-1m")),
    QWEN14B("通义千问-qwen2.5-14b",Provider.AliYunBaiLian, new BaiLianChatModel("qwen2.5-14b-instruct")),
    QWEN14B1M("通义千问-qwen2.5-14b-1m",Provider.AliYunBaiLian, new BaiLianChatModel("qwen2.5-14b-instruct-1m")),


    DEEPSEEKR1("通义千问-DeepSeek-R1",Provider.AliYunBaiLian, new BaiLianChatModel("deepseek-r1")),
    DEEPSEEKV3("通义千问-DeepSeek-V3",Provider.AliYunBaiLian, new BaiLianChatModel("deepseek-v3")),
    QWENEMBEDDINGV3("通用文本向量-v3",Provider.AliYunBaiLian, new BaiLianEmbedding("text-embedding-v3")),
    DEEPSEEKDISTILL2B("通义千问-deepseek-r1-distill-qwen-1.5b",Provider.AliYunBaiLian, new BaiLianChatModel("deepseek-r1-distill-qwen-1.5b")),
    DEEPSEEKDISTILL7B("通义千问-deepseek-r1-distill-qwen-7b",Provider.AliYunBaiLian, new BaiLianChatModel("deepseek-r1-distill-qwen-7b")),
    DEEPSEEKDISTILL14B("通义千问-deepseek-r1-distill-qwen-14b",Provider.AliYunBaiLian, new BaiLianChatModel("deepseek-r1-distill-qwen-14b"))

    ;




   // DEEPSEEK("硅基流动",Provider.SILICONFLOE, new SiliconFlowChatModel("deepseek")),;
//    AwsBedrock("Amazon Bedrock","AwsBedrock", new AwsBedrockModelProvider()),
//    Azure("Azure OpenAI","Azure", new AzureModelProvider()),
//    DeepSeek("DeepSeek","DeepSeek", new DeepSeekModelProvider()),
//    Gemini("Google DeepMind","Gemini", new GeminiModelProvider()),
//    Kimi("月之暗面","Kimi", new KimiModelProvider()),
//    Openai("OpenAI","Openai", new OpenaiModelProvider()),
//    QWen("通义千问","QWen", new QwenModelProvider()),
//    Tencent("腾讯混元","Tencent", new TencentModelProvider()),
//    VolcanicEngine("火山引擎","VolcanicEngine", new VolcanicEngineModelProvider()),
//    WenXin("文心一言","WenXin", new WenXinModelProvider()),
//    XunFei("讯飞星火","XunFei", new XfModelProvider()),
//    ZhiPu("智谱清言","ZhiPu", new ZhiPuModelProvider()),
//    Local("本地模型","model_local_provider", new LocalModelProvider()),
//    OLlama("OLlama","model_ollama_provider", new OLlamaModelProvider()),
//    VLlm("VLlm","model_vllm_provider", new VLlmModelProvider()),
//    XInference("Xorbits Inference","model_xinference_provider", new XInferenceModelProvider());

    private final String name;
    private final Provider provider;
    private final BaseModel  model;

    ModelProviderEnum(String name, Provider provider, BaseModel modelProvider) {
        this.name = name;
        this.provider = provider;
        this.model = modelProvider;
    }

    public static BaseModel get(String name) {
        if (name == null || name.isEmpty()) {
            throw new IllegalArgumentException("Provider name cannot be null or empty.");
        }
        return getMap().getOrDefault(name, null);
    }
    /**
     * 获取模型提供者的映射。
     * @return 包含所有模型提供者名称和其实例的映射
     */
    public static Map<String, BaseModel> getMap()
    {
        Map<String, BaseModel> map = new HashMap<>();
        for (ModelProviderEnum providerEnum : values()) {
            map.put(providerEnum.model.getModelName(), providerEnum.model);
        }
        return map;
    }


}
